﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Audio;

namespace DELVE_GAME.ViewStructure
{
    class MenuGameAction : GameAction
    {
        private View view;
        int stageIndex;
        SoundEffectInstance sound;

        public MenuGameAction(View targetView, int index, SoundEffectInstance newSound)
        {
            view = targetView;
            this.stageIndex = index;
            sound = newSound;
        }

        public override void doAction()
        {
            sound.Play();
            if (stageIndex == 120)
                view.quitGame();
            switch(stageIndex)
            {
                case (int)STAGES.END_GAME: view.quitGame(); break;
                case (int)STAGES.MAP_CREATION_MENU: 
                    view.resetMapCreationMenu();
                    view.gotoStage(stageIndex);
                    break;
                case (int)STAGES.MAP_SELECTION:
                    view.resetMapSelectionMenu();
                    view.gotoStage(stageIndex);
                    break;
                case (int)STAGES.REPLAY_MENU:
                    //call view to read replayManager from file and reset menu
                    view.resetReplayMenu();
                    view.gotoStage(stageIndex);
                    break;
                case (int)STAGES.GAME_LOBBY:
                    view.setNetwork(true);
                    view.gotoStage(stageIndex);
                    break;
                //NOTE: GOING TO "STAGES.GAMETYPE" HAS ITS OWN ACTION, "PlayMapSelectGameAction"
                default: view.gotoStage(stageIndex); break;
            }
        }
    }
}
